import { createSlice } from "@reduxjs/toolkit";

const userSlice = createSlice({
    name: 'user',
    initialState: {
        token: '',
        menus: [],
    },
    reducers: {
        saveToken(state, { payload }) {
            state.token = payload
        },
        saveMenus(state, { payload }) {
            state.menus = payload
        }
    }
})

export const { saveMenus, saveToken } = userSlice.actions

export default userSlice.reducer